<!DOCTYPE html>
<html><head>
	    <meta charset="utf-8">
    <title>{$settitle.title}</title>

    <meta name="description" content="Dashboard">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!--Basic Styles-->
    <link href="__admin__/style/bootstrap.css" rel="stylesheet">
    <link href="__admin__/style/font-awesome.css" rel="stylesheet">
    <link href="__admin__/style/weather-icons.css" rel="stylesheet">

    <!--Beyond styles-->
    <link id="beyond-link" href="__admin__/style/beyond.css" rel="stylesheet" type="text/css">
    <link href="__admin__/style/demo.css" rel="stylesheet">
    <link href="__admin__/style/typicons.css" rel="stylesheet">
    <link href="__admin__/style/animate.css" rel="stylesheet">
    
    <!--百度编辑器-->
    <script src="__plus__/ueditor/ueditor.config.js"></script>
    <script src="__plus__/ueditor/ueditor.all.min.js"></script>
    <script src="__plus__/ueditor/lang/zh-cn/zh-cn.js"></script>
    <style type="text/css">
        .price{
        width: 150px;
        margin-left: 10px;
        display: inline-block;
        }*/
/*        .abtn{
        padding-right: 10px;
        }*/
    </style>
</head>

<body>
	<!-- 头部 -->
    {include file="common/top"}
	<!-- /头部 -->
	
	<div class="main-container container-fluid">
		<div class="page-container">
        <!-- 左部 -->   
            {include file="common/left"}
        <!-- /左部 -->
            <!-- Page Content -->
            <div class="page-content">
                <!-- Page Breadcrumb -->
                <div class="page-breadcrumbs">
                    <ul class="breadcrumb">
                        <li>
                            <a href="#">{$settitle.first}</a>
                        </li>
                        <li>
                            <a href="#">{$settitle.second}</a>
                        </li>
                        <li class="active">
                            {$settitle.third}
                        </li>
                    </ul>
                </div>
                <!-- /Page Breadcrumb -->

                <!-- Page Body -->
                <div class="page-body">
                    
<div class="row">
    <div class="col-lg-12 col-sm-12 col-xs-12">
        <div class="widget">
            <div class="widget-body">
                <div id="horizontal-form">
                    <form class="form-horizontal" role="form" action="" method="post" enctype="multipart/form-data">
                        <!-- 商品信息开始 -->
                        <div class="widget flat radius-bordered">
                            <div class="widget-header bg-themeprimary">
                                <span type="button" class="widget-caption">{$settitle.third}</span>
                            </div>
                            <div class="widget-body">
                                <div class="widget-main ">
                                    <div class="tabbable">
                                        <ul class="nav nav-tabs  tabs-flat">
                                            <li class="active"><a data-toggle="tab" href="#baseinfo" aria-expanded="false">商品基本信息</a></li>
                                            <li class=""><a data-toggle="tab" href="#goodsdes" aria-expanded="true">商品描述信息</a></li>
                                   <!--          <li class=""><a data-toggle="tab" href="#mbprice" aria-expanded="false">会员价格</a></li>
                                            <li class=""><a data-toggle="tab" href="#goodsattr" aria-expanded="false">商品属性</a></li>
                                            <li class=""><a data-toggle="tab" href="#goodsphotos" aria-expanded="false">商品相册</a></li> -->
                                        </ul>
                                        <div class="tab-content  tabs-flat">
                                            <div class="tab-pane active" id="baseinfo">
                                                <div class="form-group">
                                                    <label for="brand_name" class="col-sm-2 control-label no-padding-right">商品名称</label>
                                                    <div class="col-sm-6">
                                                        <input class="form-control" placeholder="" name="goods_name" required="" type="text">
                                                    </div>
                                                    <p class="help-block col-sm-4 red">* 必填</p>
                                                </div>
                                                <div class="form-group">
                                                    <label for="brand_name" class="col-sm-2 control-label no-padding-right">商品主图</label>
                                                    <div style="margin-top:-3px;" class="col-sm-6">
                                                        <input class="form-control" style="border:none;box-shadow:none;" name="og_thumb" type="file">
                                                    </div>
                                                    <p class="help-block col-sm-4 red">* 必填</p>
                                                </div>

                                                <div class="form-group">
                                                    <label for="username" class="col-sm-2 control-label no-padding-right">是否上架</label>
                                                    <div class="col-sm-6">
                                                        <div class="radio" style="float:left;">
                                                            <label>
                                                                <input checked="checked" class="colored-success" value="1" name="on_sale" type="radio">
                                                                <span class="text">是</span>
                                                            </label>
                                                        </div>
                                                        <div class="radio" style="padding-left:160px;">
                                                            <label>
                                                                <input class="colored-blueberry" value="0" name="on_sale" type="radio">
                                                                <span class="text">否</span>
                                                            </label>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="form-group">
                                                    <label for="brand_name" class="col-sm-2 control-label no-padding-right">所属栏目</label>
                                                    <div class="col-sm-6">
                                                       <select name="category_id">
                                                           <option>请选择</option>
                                                                {volist name="categoryRes" id="category"}
                                                                    <option value="{$category.id}"><?php echo str_repeat('------|',$category['level']);?>{$category.cate_name}</option>
                                                                {/volist}
                                                       </select>
                                                    </div>
                                                    <p class="help-block col-sm-4 red">* 必填</p>
                                                </div>  
                                                <div class="form-group">
                                                    <label for="brand_name" class="col-sm-2 control-label no-padding-right">所属品牌</label>
                                                    <div class="col-sm-6">
                                                       <select name="brand_id">
                                                               <option>请选择</option>
                                                               {volist name="brandRes" id="brand"}
                                                                    <option value="{$brand.id}">{$brand.brand_name}</option>
                                                               {/volist}
                                                       </select>
                                                    </div>
                                                    <p class="help-block col-sm-4 red">*必填</p>
                                                </div>
                                                <div class="form-group">
                                                    <label for="brand_name" class="col-sm-2 control-label no-padding-right">所属类型</label>
                                                    <div class="col-sm-6">
                                                       <select name="type_id">
                                                               <option>请选择</option>
                                                               {volist name="typeRes" id="type"}
                                                                    <option value="{$type.id}">{$type.type_name}</option>
                                                               {/volist}
                                                       </select>
                                                    </div>
                                                    <p class="help-block col-sm-4 red">*必填</p>
                                                </div> 
                                                <div class="form-group">
                                                    <label for="brand_name"  class="col-sm-2 control-label no-padding-right">市场价格</label>
                                                    <div class="col-sm-3">
                                                        <input class="form-control" placeholder="" name="market_price" required="" type="text">
                                                    </div>
                                                    <p class="help-block col-sm-4 red">* 必填</p>
                                                </div>
                                                <div class="form-group">
                                                    <label for="brand_name" class="col-sm-2 control-label no-padding-right">本店价格</label>
                                                    <div class="col-sm-3">
                                                        <input class="form-control" placeholder="" name="shop_price" required="" type="text">
                                                    </div>
                                                    <p class="help-block col-sm-4 red">* 必填</p>
                                                </div>
                                                <div class="form-group">
                                                    <label for="brand_name" class="col-sm-2 control-label no-padding-right">商品重量</label>
                                                    <div class="col-sm-6">
                                                        <input class="form-control" style="width:223px;display:inline-block;" placeholder="" name="goods_weight" required="" type="text">
                                                        <select name="weight_unit">
                                                            <option value="kg">kg</option>
                                                            <option value="g">g</option>
                                                            <option value="0">虚拟商品无重量</option>
                                                        </select>
                                                    </div>
                                                    <p class="help-block col-sm-4 red">* 必填</p>
                                                </div>                           
                                            </div>
                                            <div class="tab-pane" id="goodsdes">                                    
                                                <div class="form-group">
                                                    <label for="content" class="col-sm-2 control-label no-padding-right">商品描述</label>
                                                    <div class="col-sm-6">
                                                        <textarea id="content" name="goods_des"></textarea>
                                                    </div>
                                                </div> 
                                            </div>
                         <!--                    <div class="tab-pane" id="mbprice">                                    
                                                    {volist name="memberLeverRes" id="mlRes"}
                                                        <div class="form-group">
                                                            <label for="brand_name" class="col-sm-2 control-label no-padding-right">{$mlRes.level_name}</label>
                                                            <div class="col-sm-2">
                                                                <input class="form-control" placeholder="" name="title" required="" type="text">
                                                            </div>
                                                        </div>
                                                    {/volist}
                                            </div>
                                            <div class="tab-pane" id="goodsattr">                                    
                                                <div class="form-group">
                                                    <label for="brand_name" class="col-sm-2 control-label no-padding-right">商品类型</label>
                                                    <div class="col-sm-6">
                                                       <select name="type_id">
                                                           <option value="">请选择商品类型</option>
                                                           {volist name="typeRes" id="type"}
                                                                <option value="{$type.id}">{$type.type_name}</option>
                                                           {/volist}
                                                       </select>
                                                    </div>
                                                </div> 
                                                <div id="attr_list"> -->
                                                    <!--ajax+jquery属性展示-->
                               <!--                  </div>
                                            </div>
                                            <div class="tab-pane" id="goodsphotos">                                    
                                                <div class="form-group">
                                                    <label for="brand_name" class="col-sm-2 control-label no-padding-right">商品相册</label>
                                                    <div class="col-sm-3">
                                                        <input class="form-control" style="border:none;box-shadow:none;width:20%;display: inline-block;" name="title"  type="file">
                                                        <a type='button' onclick='addphoto(this)' style='margin-bottom:6px;margin-left:2px;' class='btn btn-purple' href='#'>添加</a>
                                                    </div>
                                                    <div id="goods_photo"> -->
                                                        <!--ajax+jquery添加商品相册-->
                                      <!--               </div>
                                                </div>
                                            </div> -->

                                        </div>
                                    </div>                        
                                </div>
                            </div>
                        </div>
 <!-- 商品信息结束 -->
                        <div style="margin-top:120px;" class="form-group">
                            <div style="margin-bottom:10px;" class="col-sm-offset-2 col-sm-10">
                                <button type="submit" class="btn btn-default">保存信息</button>
                                <button style="margin-left:80px;" type="button" class="btn btn-default"  onClick="javascript :history.go(-1);">返回上页</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

                </div>
                <!-- /Page Body -->
            </div>
            <!-- /Page Content -->
		</div>	
	</div>

	    <!--Basic Scripts-->
    <script src="__admin__/style/jquery_002.js"></script>
    <script src="__admin__/style/bootstrap.js"></script>
    <script src="__admin__/style/jquery.js"></script>
    <!--Beyond Scripts-->
    <script src="__admin__/style/beyond.js"></script>
    
    <script type="text/javascript">
    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    UE.getEditor('content',{initialFrameWidth:800,initialFrameHeight:400,});
    </script>

    <script type="text/javascript">
        $("select[name=type_id]").change(function()
        {
            var type_id=$(this).val();
            $.ajax({
                type:"POST",
                url:"{:url('Attr/ajaxGetAttr')}",
                data:{type_id:type_id},
                dataType:"json",
                success:function(data){
                    var html="";
                    $(data).each(function(k,v){
                        if(v.attr_type==1)
                        {
                            /*单选属性处理*/
                            html+="<div class='form-group'>";
                            html+="<label class='col-sm-2 control-label no-padding-right'>"+v.attr_name+"</label>";
                            html+="<div class='col-sm-6'>";
                            var attrValuesArr=v.attr_values.split(",");
                            html+="<select>";
                            html+="<option>请选择</option>"
                            for (var i=0;i<attrValuesArr.length;i++) {
                                html+="<option value='"+attrValuesArr[i]+"'>"+attrValuesArr[i]+"</option>"
                               }
                            html+="</select>";
                            html+="<input class='form-control price' placeholder='价格' type='text'>";
                            html+="<a type='button' onclick='addrow(this)' style='margin-bottom:6px;margin-left:2px;' class='btn btn-purple' href='#'>添加</a>";
                            html+="</div>";
                            html+="</div>";
                        }else
                        {
                            /*唯一属性处理*/
                            if(v.attr_values)
                            {
                                html+="<div class='form-group'>";
                                html+="<label class='col-sm-2 control-label no-padding-right'>"+v.attr_name+"</label>";
                                html+="<div class='col-sm-6'>";
                                var attrValuesArr=v.attr_values.split(",");
                                html+="<select>";
                                html+="<option>请选择</option>"
                                for (var i=0;i<attrValuesArr.length;i++) {
                                    html+="<option value='"+attrValuesArr[i]+"'>"+attrValuesArr[i]+"</option>"
                                   }
                                html+="</select>";
                                html+="</div>";
                                html+="</div>";
                            }else
                            {
                                html+="<div class='form-group'>";
                                html+="<label class='col-sm-2 control-label no-padding-right'>"+v.attr_name+"</label>";
                                html+="<div class='col-sm-3'>"
                                html+="<input class='form-control' type='text'/>";
                                html+="</div>";
                                html+="</div>";
                            }
                        }
                    });
                    $("#attr_list").html(html);
                }
            })
        })
        //动态添加属性
        function addrow(o)
        {
            var div=$(o).parent().parent();
            if($(o).html()=="添加")
            {
                var newdiv=div.clone();
                newdiv.find('a').html('删除');
                div.after(newdiv);
            }else
            {
                div.remove();

            }
        }

        //动态添加相册
        function addphoto(o)
        {
            var div=$(o).parent().parent();
            if($(o).html()=="添加")
            {
                var newdiv=div.clone();
                newdiv.find('a').html('删除');
                div.after(newdiv);
            }else
            {
                div.remove();
            }
        }

    </script>
</body></html>